package various;


import lejos.nxt.LCD;
import lejos.nxt.Motor;
import lejos.nxt.SensorPort;
import lejos.nxt.UltrasonicSensor;

public class ProvaColore1 {
	public static void main(String[] args) throws Exception {
		// ColorSensor coloursense=new ColorSensor(SensorPort.S1);
		UltrasonicSensor us = new UltrasonicSensor(SensorPort.S2);
		// LinkedList<String> serie=new LinkedList<String>();
		// String colour=Colori.getColor(coloursense.getColorNumber());
		LCD.clear();
		// LCD.drawString(colour, 0, 0);
		// while(us.getDistance()>4.5){
		// Motor.A.setSpeed(100);
		// Motor.A.forward();
		// }
		// Motor.A.stop();
		// LCD.clear();
		LCD.drawInt(Motor.A.getTachoCount(), 0, 0);
		for (int i = 0; i < 3; i++) {
			while (Motor.A.getTachoCount() < 545) {
				Motor.A.setSpeed(150);
				Motor.A.forward();
				LCD.drawInt(Motor.A.getTachoCount(), 0, 0);
			}
			while (Motor.A.getTachoCount() > 5) {
				Motor.A.setSpeed(150);
				Motor.A.backward();
				LCD.drawInt(Motor.A.getTachoCount(), 0, 0);
			}
			Motor.A.setBrakePower(500);
			Motor.A.stop();
			// Thread.sleep(2000);
		}

	}

}
